import { listNoticeApi } from "@/api/sunnyNotice";
import type { SunnyNotice } from "@/types/sunnyNotice/type";
import { defineStore } from "pinia";
import { ref } from "vue";

export const useSunnyNoticeStore = defineStore("sunnyNotice", () => {
  const noticeList = ref<SunnyNotice[]>([]);

  function listNotices() {
    return listNoticeApi().then(({ data }) => {
      noticeList.value = data;
    });
  }

  return { noticeList, listNotices };
});
